Create proc proc_updateVatTuHangHoa
(
 @MaVatTu varchar(10),
 @TenVatTu Nvarchar(100)
)
as
begin
 declare @TenVatTu1 Nvarchar(100)
 
 select @TenVatTu1 = Case when @TenVatTu = null or @TenVatTu ='' then TenVatTu else @TenVatTu end from VatTuHangHoa
 where @MaVatTu = MaVatTu
 
 update VatTuHangHoa
 set TenVatTu = @TenVatTu1
 where @MaVatTu = MaVatTu
end
go

Create proc proc_updateDonViTinh
(
 @STT		int,
 @DonViTinh		nvarchar(20),
 @GiaTriQuiDoi	float,
 @LaMacDinh		bit
)
as
UPDATE [QuanLyKho].[dbo].[DonViTinh]
   SET [DonViTinh] = @DonViTinh
      ,[GiaTriQuiDoi] = @GiaTriQuiDoi
      ,[LaMacDinh] = @LaMacDinh
WHERE STT = @STT
go

Create proc proc_updateKho
(
 @MaKho			varchar(10),
 @TenKho		nvarchar(100)
)
as
UPDATE [QuanLyKho].[dbo].[Kho]
   SET [TenKho] = @TenKho
 WHERE [MaKho] = @MaKho
go

Create proc proc_updateTienTe
(
 @KyHieu varchar(10),
 @LoaiTien nvarchar(100),
 @TyGia float
)
as
UPDATE [QuanLyKho].[dbo].[TienTe]
   SET [LoaiTien] = @LoaiTien
      ,[TyGia] = @TyGia
 WHERE [KyHieu] = @KyHieu
GO

Create proc proc_updateNhapKhau
(
 @SoChungTu		varchar(10),
 @Ngay			datetime,
 @TenNhaCungCap	nvarchar(100),
 @MaHopDong		varchar(10),
 @LoaiTien		varchar(10),
 @DaXacNhan		bit,
 @DaTraTien		bit,
 @TongCong		float,
 @TenTaiKhoan 	nvarchar(20),
 @GhiChu		ntext
)
as
begin
 declare @MaNhaCungCap varchar(10),
		 @MaTaiKhoan int
		 
 set @MaHopDong = dbo.func_getMaNhaCungCapFromTenNhaCungCap(@TenNhaCungCap)
 set @MaTaiKhoan = dbo.func_getMaTaiKhoanFromTenTaiKhoan(@TenTaiKhoan)
		 
 UPDATE [QuanLyKho].[dbo].[NhapKhau]
   SET [MaNhaCungCap] = @MaNhaCungCap
      ,[MaHopDong] = @MaHopDong
      ,[LoaiTien] = @LoaiTien
      ,[DaXacNhan] = @DaXacNhan
      ,[DaTraTien] = @DaTraTien
      ,[TongCong] = @TongCong
      ,[MaTaiKhoan] = @MaTaiKhoan
      ,[GhiChu] = @GhiChu
 WHERE [SoChungTu] = @SoChungTu
   and [Ngay] = @Ngay

end
go